<!DOCTYPE html>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:fb="http://ogp.me/ns/fb#">

    <h:form id="form_product">
        <h:panelGroup rendered="#{not empty searchc.product}">
            <h:dataTable value="#{searchc.product}" var="p">
                <h:column>
                    <h1>
                        <h:graphicImage value="#{p.operation.operation == 'troca' ? '/resources/image/operation/exchange_32.jpg': '/resources/image/operation/donation_32.jpg'}" />
                        <h:outputText value="#{p.operation.operation == 'troca' ? 'Troca' : 'Doação'}" />
                    </h1>
                    <h2>
                        <h:outputText value="#{p.name}" />
                    </h2>
                    
                    <ui:repeat value="#{searchc.product.productPictures}" var="pp">
                        <a rel="fancy_box_group" href="#{pp.picture}" title="#{p.name}">
                            <h:graphicImage  value="#{pp.picture}" height="75" width="75" />
                        </a>
                    </ui:repeat>
                    
                    <h3>Descrição</h3>                                
                    <h:panelGrid columns="2">
                        <h:outputText value="#{p.quantity}" />
                        <h:outputText value="#{p.measure.measure}" />
                    </h:panelGrid>
                    
                    <h3>Localização</h3>                                
                    <h:panelGrid columns="2">
                        <h:outputText value="#{p.location.city.city}" />
                        <h:outputText value="(#{p.location.state.state})" />
                    </h:panelGrid>
                    
                    <h3>Sobre</h3>                                
                    <h:panelGrid>
                        <h:outputText value="#{p.description}" />
                    </h:panelGrid>
                        
                </h:column>
            </h:dataTable>
            
            <h3>Comentários</h3>                                
            <fb:comments href="http://suaparte.org/system/product?p=c#{searchc.product.id}" num_posts="2" width="500"></fb:comments>
        </h:panelGroup>
    </h:form>

</ui:composition>		